```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java垃圾收集器详解 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-title {
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .gradient-text {
            background: linear-gradient(90deg, #4f46e5, #10b981);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:after {
            content: '';
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(99, 102, 241, 0.2);
            z-index: -1;
            transform: skewY(-1deg);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="relative py-20 bg-gradient-to-r from-blue-900 to-purple-900 text-white overflow-hidden">
        <div class="absolute inset-0 opacity-20">
            <div class="absolute inset-0 bg-gradient-to-b from-transparent to-black opacity-50"></div>
        </div>
        <div class="container mx-auto px-6 relative z-10">
            <div class="flex flex-col items-center justify-center text-center max-w-4xl mx-auto">
                <h1 class="text-4xl md:text-6xl font-bold mb-6 hero-title">Java垃圾收集器<span class="gradient-text">深度解析</span></h1>
                <p class="text-xl md:text-2xl opacity-90 mb-10 max-w-3xl leading-relaxed">
                    探索不同垃圾收集器的设计哲学与性能特性，为您的应用选择最佳的内存管理方案
                </p>
                <div class="flex space-x-4">
                    <a href="#content" class="px-6 py-3 bg-white text-blue-900 font-medium rounded-full hover:bg-gray-100 transition-all duration-300 shadow-lg hover:shadow-xl flex items-center">
                        <i class="fas fa-book-open mr-2"></i> 开始阅读
                    </a>
                    <a href="#visualization" class="px-6 py-3 border border-white text-white font-medium rounded-full hover:bg-white hover:bg-opacity-10 transition-all duration-300 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 可视化比较
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-16" id="content">
        <article class="max-w-4xl mx-auto">
            <div class="bg-white rounded-xl shadow-md p-8 mb-16">
                <p class="text-lg text-gray-700 leading-relaxed mb-6">
                    在Java的世界里，垃圾收集器(GC)扮演着内存管理的核心角色。<span class="highlight font-medium">每种垃圾收集器有其独特的设计目标和适用场景，选择合适的垃圾收集器可以显著影响Java应用程序的性能和响应时间。</span>通常，选择垃圾收集器时需要根据应用程序的特性（如内存大小、延迟要求、吞吐量需求等）来决定最合适的方案。
                </p>
                
                <div class="my-10 border-l-4 border-blue-500 pl-6">
                    <p class="text-sm uppercase tracking-wider text-blue-600 font-semibold mb-2">关键提示</p>
                    <p class="text-lg font-semibold text-gray-800">
                        <i class="fas fa-info-circle text-blue-500 mr-2"></i> JDK8环境下，默认使用 Parallel Scavenge + Parallel Old
                    </p>
                </div>

                <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1660452404796-dce07568-0552-455d-b9e3-f4c1aa20d64b.png" alt="垃圾收集器分类" class="w-full rounded-lg shadow-md mb-10">
            </div>

            <!-- GC Cards Section -->
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-16">
                <!-- Serial GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-blue-100 text-blue-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">基础型</span>
                            <h3 class="text-xl font-bold text-gray-900">Serial Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 标记-清除/整理
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-clock mr-1"></i> 单线程
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> Serial GC是最基本的垃圾收集器，采用单线程执行垃圾回收。它在进行垃圾回收时会暂停所有用户线程，因此适用于小型应用或单核处理器的环境。主要用于JVM的小堆内存配置。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：客户端应用、嵌入式系统
                        </div>
                    </div>
                </div>

                <!-- Parallel GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-purple-100 text-purple-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">吞吐量优先</span>
                            <h3 class="text-xl font-bold text-gray-900">Parallel Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 标记-清除/整理
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-tachometer-alt mr-1"></i> 多线程
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> Parallel GC是Serial GC的多线程版本，旨在提高吞吐量。它通过多线程来执行垃圾回收工作，以缩短垃圾回收的停顿时间，适用于多核处理器的环境。默认使用于大多数服务器配置的JVM。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：后端服务、批处理系统
                        </div>
                    </div>
                </div>

                <!-- CMS GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-green-100 text-green-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">低延迟</span>
                            <h3 class="text-xl font-bold text-gray-900">CMS Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 并发标记-清除
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-bolt mr-1"></i> 并发收集
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> CMS垃圾收集器的主要目标是减少垃圾回收的停顿时间。它将垃圾回收过程分为多个阶段，其中标记和清除阶段在用户线程执行的同时并发进行。虽然CMS能够降低停顿时间，但它可能会导致内存碎片问题。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：Web应用、响应式系统
                        </div>
                    </div>
                </div>

                <!-- G1 GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-red-100 text-red-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">平衡型</span>
                            <h3 class="text-xl font-bold text-gray-900">G1 Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 分区标记-整理
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-sliders-h mr-1"></i> 可预测停顿
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> G1 GC旨在为大堆内存配置的JVM提供低延迟和高吞吐量。它将堆内存划分为多个区域，并通过分代的方式管理这些区域。G1 GC使用的回收算法能够在多个阶段中并行进行垃圾回收，并根据用户设定的目标停顿时间来进行回收。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：大内存应用、混合负载
                        </div>
                    </div>
                </div>

                <!-- ZGC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-indigo-100 text-indigo-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">超低延迟</span>
                            <h3 class="text-xl font-bold text-gray-900">Z Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 并发标记-整理
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-rocket mr-1"></i> 极低停顿
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> ZGC是一个低延迟垃圾收集器，设计用于处理大规模内存和低延迟需求。它通过并发标记、并发整理和极低的停顿时间来实现高效的垃圾回收。ZGC能够在垃圾回收期间几乎不暂停应用程序的执行。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：金融交易、实时系统
                        </div>
                    </div>
                </div>

                <!-- Shenandoah GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-teal-100 text-teal-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">低延迟</span>
                            <h3 class="text-xl font-bold text-gray-900">Shenandoah GC</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 并发标记-整理
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-sync-alt mr-1"></i> 并发回收
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> Shenandoah GC是另一个低延迟垃圾收集器，目标是减少垃圾回收的停顿时间。它通过并发回收和并行处理来降低停顿时间，并且在回收期间几乎不会对应用程序造成影响。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：实时数据处理、低延迟应用
                        </div>
                    </div>
                </div>

                <!-- Epsilon GC -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card transition-all duration-300 col-span-1 md:col-span-2">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <span class="bg-gray-100 text-gray-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-2">特殊用途</span>
                            <h3 class="text-xl font-bold text-gray-900">Epsilon Garbage Collector</h3>
                        </div>
                        <div class="mb-4">
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-microchip mr-1"></i> 无回收
                            </span>
                            <span class="inline-block bg-gray-100 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
                                <i class="fas fa-flask mr-1"></i> 实验性
                            </span>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>特点：</strong> Epsilon GC是一个"无操作"的垃圾收集器，不执行任何垃圾回收。它主要用于测试和调试，适用于不需要垃圾回收的特定场景或用于性能基准测试。</p>
                        <div class="text-sm text-gray-500 mt-4">
                            <i class="fas fa-lightbulb mr-1 text-yellow-500"></i> 适用场景：性能测试、短期应用
                        </div>
                    </div>
                </div>
            </div>

            <!-- Visualization Section -->
            <div class="bg-white rounded-xl shadow-md p-8 mb-16" id="visualization">
                <h2 class="text-3xl font-bold text-gray-900 mb-8 text-center">垃圾收集器<span class="gradient-text">性能特性</span>对比</h2>
                
                <div class="mermaid">
                    %%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#E5E7EB', 'primaryBorderColor': '#9CA3AF', 'lineColor': '#6B7280'}}}%%
                    flowchart TD
                        A[垃圾收集器] --> B[串行收集器\nSerial GC]
                        A --> C[并行收集器\nParallel GC]
                        A --> D[并发收集器\nCMS]
                        A --> E[G1 GC]
                        A --> F[ZGC]
                        A --> G[Shenandoah]
                        A --> H[Epsilon]
                        
                        B -->|特点| B1[单线程\nStop-the-World\n小堆内存]
                        C -->|特点| C1[多线程\n高吞吐量\n服务器默认]
                        D -->|特点| D1[并发标记\n低暂停\n内存碎片]
                        E -->|特点| E1[分区域\n可预测停顿\n大堆内存]
                        F -->|特点| F1[超低延迟\n并发整理\nTB级堆]
                        G -->|特点| G1[低延迟\n并发回收]
                        H -->|特点| H1[无回收\n测试用途]
                        
                        classDef gcClass fill:#f3f4f6,stroke:#9CA3AF,stroke-width:2px,color:#111827
                        class B,C,D,E,F,G,H gcClass
                        
                        classDef featureClass fill:#EFF6FF,stroke:#3B82F6,stroke-width:2px,color:#1E40AF
                        class B1,C1,D1,E1,F1,G1,H1 featureClass
                </div>

                <div class="mt-12 grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="bg-blue-50 rounded-lg p-6 border border-blue-200">
                        <h3 class="text-lg font-semibold text-blue-800 mb-3 flex items-center">
                            <i class="fas fa-tachometer-alt mr-2"></i> 吞吐量比较
                        </h3>
                        <p class="text-gray-700 mb-4">Parallel GC > G1 > CMS > Serial > ZGC ≈ Shenandoah</p>
                        <div class="h-4 bg-gray-200 rounded-full overflow-hidden">
                            <div class="h-full bg-blue-500 rounded-full" style="width: 100%"></div>
                        </div>
                    </div>
                    
                    <div class="bg-purple-50 rounded-lg p-6 border border-purple-200">
                        <h3 class="text-lg font-semibold text-purple-800 mb-3 flex items-center">
                            <i class="fas fa-clock mr-2"></i> 延迟比较
                        </h3>
                        <p class="text-gray-700 mb-4">ZGC ≈ Shenandoah < CMS < G1 < Serial < Parallel</p>
                        <div class="h-4 bg-gray-200 rounded-full overflow-hidden">
                            <div class="h-full bg-purple-500 rounded-full" style="width: 20%"></div>
                        </div>
                    </div>
                    
                    <div class="bg-green-50 rounded-lg p-6 border border-green-200">
                        <h3 class="text-lg font-semibold text-green-800 mb-3 flex items-center">
                            <i class="fas fa-memory mr-2"></i> 内存占用
                        </h3>
                        <p class="text-gray-700 mb-4">G1 ≈ ZGC ≈ Shenandoah > CMS > Parallel > Serial</p>
                        <div class="h-4 bg-gray-200 rounded-full overflow-hidden">
                            <div class="h-full bg-green-500 rounded-full" style="width: 80%"></div>
                        </div>
                    </div>
                </div>

                <div class="mt-10 bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-r-lg">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="fas fa-exclamation-circle text-yellow-500 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h3 class="text-sm font-medium text-yellow-800">选择建议</h3>
                            <div class="mt-2 text-sm text-yellow-700">
                                <p>• 追求高吞吐量 → Parallel GC</p>
                                <p>• 需要低延迟 → ZGC/Shenandoah</p>
                                <p>• 平衡型选择 → G1 GC</p>
                                <p>• 小内存应用 → Serial GC</p>
                                <p>• 特殊测试 → Epsilon GC</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Summary Section -->
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold text-gray-900 mb-6">关键<span class="gradient-text">总结</span></h2>
                <div class="prose max-w-none text-gray-700">
                    <p>Java垃圾收集器的选择需要权衡多个因素，没有一个放之四海而皆准的解决方案。以下是主要考虑因素：</p>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 my-6">
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-blue-700"><i class="fas fa-check-circle mr-2"></i>考虑因素</h3>
                            <ul class="space-y-2">
                                <li><i class="fas fa-caret-right text-blue-500 mr-2"></i> 应用对停顿时间的敏感度</li>
                                <li><i class="fas fa-caret-right text-blue-500 mr-2"></i> 系统的吞吐量需求</li>
                                <li><i class="fas fa-caret-right text-blue-500 mr-2"></i> 可用硬件资源(CPU核心数)</li>
                                <li><i class="fas fa-caret-right text-blue-500 mr-2"></i> 堆内存大小</li>
                                <li><i class="fas fa-caret-right text-blue-500 mr-2"></i> 应用的生命周期特点</li>
                            </ul>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-purple-700"><i class="fas fa-route mr-2"></i>演进趋势</h3>
                            <ul class="space-y-2">
                                <li><i class="fas fa-arrow-right text-purple-500 mr-2"></i> 从停顿明显(STW)向低延迟发展</li>
                                <li><i class="fas fa-arrow-right text-purple-500 mr-2"></i> 从分代模型向分区模型转变</li>
                                <li><i class="fas fa-arrow-right text-purple-500 mr-2"></i> 并发处理能力不断增强</li>
                                <li><i class="fas fa-arrow-right text-purple-500 mr-2"></i> 对大堆内存支持更好</li>
                                <li><i class="fas fa-arrow-right text-purple-500 mr-2"></i> 可预测的停顿时间</li>
                            </ul>
                        </div>
                    </div>
                    
                    <p class="mt-6 px-4 py-3 bg-gray-100 rounded-lg border-l-4 border-blue-500">
                        <strong>现代应用建议：</strong> 对于大多数现代应用，G1 GC是一个很好的起点，它在吞吐量和延迟之间取得了良好的平衡。对于有严格低延迟要求的应用，可以考虑ZGC或Shenandoah。JDK17+版本中，ZGC和Shenandoah已经成为生产可用的成熟选项。
                    </p>
                </div>
            </div>
        </article>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto px-6">
            <div class="flex flex-col items-center">
                <div class="text-xl font-semibold text-white mb-2">技术小馆</div>
                <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition-colors duration-300">
                    <i class="fas fa-external-link-alt mr-1"></i> http://www.yuque.com/jtostring
                </a>
                <div class="mt-6 text-sm text-gray-500">
                    &copy; 2023 技术小馆. 保留所有权利.
                </div>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```